package com.nbsaas.boot.customer.rest.resource;

import com.nbsaas.boot.customer.api.apis.CustomerAddressApi;
import com.nbsaas.boot.customer.data.entity.CustomerAddress;
import com.nbsaas.boot.customer.api.domain.request.CustomerAddressRequest;
import com.nbsaas.boot.customer.api.domain.response.CustomerAddressResponse;
import com.nbsaas.boot.customer.api.domain.simple.CustomerAddressSimple;
import com.nbsaas.boot.customer.rest.convert.CustomerAddressSimpleConvert;
import com.nbsaas.boot.customer.rest.convert.CustomerAddressEntityConvert;
import com.nbsaas.boot.customer.rest.convert.CustomerAddressResponseConvert;
import com.nbsaas.boot.customer.data.repository.CustomerAddressRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   收货地址-业务接口实现
*/
@Transactional
@Service
public class CustomerAddressResource extends BaseResource<CustomerAddress,CustomerAddressResponse, CustomerAddressSimple, CustomerAddressRequest>  implements CustomerAddressApi {

    @Resource
    private CustomerAddressRepository customerAddressRepository;

    @Override
    public JpaRepositoryImplementation<CustomerAddress, Serializable> getJpaRepository() {
        return customerAddressRepository;
    }

    @Override
    public Function<CustomerAddress, CustomerAddressSimple> getConvertSimple() {
        return new CustomerAddressSimpleConvert();
    }

    @Override
    public Function<CustomerAddressRequest, CustomerAddress> getConvertForm() {
        return new CustomerAddressEntityConvert();
    }

    @Override
    public Function<CustomerAddress, CustomerAddressResponse> getConvertResponse() {
        return new CustomerAddressResponseConvert();
    }




}


